Conversation
|
When would this feature be disabled? |
|
Using Since the main motivation for disabling docs is to reduce wasm size, it is assumed that for That said maybe that assumption is not always true and it should be opt-in. |
Sorry I think I misunderstood what you meant here, you are asking why you would want to disable docs at all. It would be for wasm size because now all I am running benchmarks today to measure the difference, but as mentioned here #6 (comment), ideally we would have it enabled. |
|
Ahh all scale-info types would provide docs as well. Okay. However, I'm not sure we should use a feature flag for this. The problem I see is that feature flags are very hard to "control" in rust, like they easily leak when you enable them somewhere. |
|
Sure but what alternative is there to avoid the doc strings being captured? |
|
Can we not disable the feature at runtime? |
|
How do you mean? We could indeed remove already captured docs at runtime. But the docs are captured statically by the macro so the strings will already be included in the binary. Perhaps another option is to store the actual doc strings in a custom section, and have lookups into that. Then some wasm post-processing can remove the custom section if required e.g. Just thinking out loud, I am not sure whether that will work or not. With all that said, if the wasm blob sizes are still manageable with docs included then we can remove this feature entirely. |
Ahh yeah, makes sense 👍 |
|
We might be able to close this if we go with my current solution, which is only to include the required docs in metadata: paritytech/substrate#8615 (comment), depends on paritytech/scale-info#118 |
|
Even for few Ks I'd say is worth allowing to opt out :) |
|
I see paritytech/scale-info#118 is merged... |
|
Closing as probably this isn't needed if it's been sitting here this long... |
Add a
docsfeature which when enabled will cause docs to be captured.Adds a builder method to types with docs (
StorageEntryMetadataandPalletConstantMetadata), which becomes an inline no-op when the feature is disabled. The compiler should then optimize away the static strngs.